package com.ksm.domain.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@Entity
@Table(name = "T_TAUX", uniqueConstraints = { @UniqueConstraint(columnNames = { "LIBELLE", "TAUX" }) })
public class Taux extends GenericEntity {

	private static final long serialVersionUID = 1366711488117888523L;

	private String libelle;
	private Double taux;
	private TypeTaux type;

	public Taux() {
		super();
	}

	public Taux(String libelle, Double taux, TypeTaux type) {
		super();
		this.libelle = libelle;
		this.taux = taux;
		this.type = type;
	}

	@Column(name = "LIBELLE", length = 20, unique = true)
	public String getLibelle() {
		return libelle;
	}

	public void setLibelle(String libelle) {
		this.libelle = libelle;
	}

	@Column(name = "TAUX", precision = 2, unique = true)
	public Double getTaux() {
		return taux;
	}

	@Column(name = "TYPE")
	@Enumerated(EnumType.STRING)
	public TypeTaux getType() {
		return type;
	}

	public void setType(TypeTaux type) {
		this.type = type;
	}

	public void setTaux(Double taux) {
		this.taux = taux;
	}

	public enum TypeTaux {
		TVA, IS, IR;
	}

}
